package com.dimong.www.loan.ui.base;

import android.content.Context;
import android.os.Bundle;
import android.view.ViewGroup;

import com.dimong.loan.sdk.ui.act.BaseFragmentActivity;
import com.dimong.www.loan.R;
import com.dimong.www.loan.widget.ActionBarView;

public abstract class BaseTitleFragment extends BaseRefreshFragment {
    protected String TAG = getClass().getSimpleName();
    protected BaseFragmentActivity mBaseActivity;
    protected Context mContext;
    protected ActionBarView mTitle;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mContext = context;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!(getActivity() instanceof BaseFragmentActivity)) {
            throw new ClassCastException("Hosting Activity must implement BaseActivity");
        } else {
            this.mBaseActivity = (BaseFragmentActivity) getActivity();
        }
    }

    @Override
    public void initView() {
        super.initView();
        mTitle = getActivity().findViewById(R.id.title_base);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (mContentView != null) {
            ((ViewGroup) mContentView.getParent()).removeView(mContentView);
        }
    }
}
